#include"TcpServer.hpp"
#include<memory>
#include"command.hpp"


void Useage(char* ch[])
{
    std::cout << "Useage: " << ch[0] << " port";
    std::cout << std::endl;
}



int main(int argc,char* argv[])
{
    if(argc != 2)
    {
        Useage(argv);
        exit(1);
    }

    std::string port = argv[1];
    uint16_t _port = std::stoi(port);
    Command _cmd;
    std::unique_ptr<TcpServer> _Tptr = std::make_unique<TcpServer>(_port,[&_cmd](const std::string& cmd)->
    std::string{
        return _cmd.Start(cmd);
    });
    _Tptr->Init();
    
    _Tptr->Start();




    return 0;
}